<?php
/**
 * Nette Framework Requirements Checker template.
 *
 * @param array    $requirements
 * @param array    $errors
 * @param string   $redirect
 */

header('Content-Type: text/html; charset=utf-8');
?>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="robots" content="noindex,noarchive">
	<meta name="generator" content="Nette Framework">
	<?php if ($redirect): ?><meta http-equiv="Refresh" content="0; URL=?r=<?php echo $redirect ?>"><?php endif ?>

	<title>Nette Framework Requirements Checker</title>

	<style>
	body {
		font: 13px/1.5 "Trebuchet MS", "Geneva CE", lucida, sans-serif;
		color: #333;
		background: #fff;
	}

	h1 {
		font-size: 170%;
		color: #165ca3;
	}

	h2 {
		font-size: 150%;
		color: black;
	}

	h3 {
		font-size: 150%;
		padding: 1em;
	}

	table {
		font: 10pt/1.5 Verdana, sans-serif;
		padding: 0;
		margin: 0;
		border-collapse:collapse;
		width: 100%;
	}

	table td, table th {
		color: #525b37;
		background: #fff;
		border: 1px solid #d1cdab;
		text-align: left;
		padding: 3px;
		font-weight: normal;
	}

	th {
		font-size: 105%;
	}

	p span {
		padding: 0 .6em;
	}

	.passed {
		background: green;
		color: white;
	}

	.warning {
		background: #ffffbb;
	}

	.failed {
		background: firebrick;
		color: white;
	}

	.required {
		background: #F0F0F0;
		color: black;
	}

	.optional {
		color: #666;
	}
	</style>

	<script src="assets/checker.js"></script>
</head>

<body>
	<h1>Nette Framework Requirements Checker</h1>

	<p>This script checks if your server and PHP configuration meets the requirements
	for running <a href="http://nettephp.com/">Nette Framework</a>.</p>


	<?php if ($errors[REQUIRED]): ?>
	<h3 class="failed">Sorry, your server configuration does not satisfy the requirements of Nette Framework.</h3>
	<?php elseif ($errors[OPTIONAL]): ?>
	<h3 class="warning">Your server configuration satisfies minimum requirements of Nette Framework. Please see the warnings listed below.</h3>
	<?php else: ?>
	<h3 class="passed">Congratulations! Your server configuration satisfies all requirements of Nette Framework.</h3>
	<?php endif ?>


	<h2>Details</h2>

	<table class="result">
	<?php foreach ($requirements as $id => $requirement):?>
	<?php @list($name, $required, $result, $hint, $script) = $requirement ?>
	<?php $class1 = $result === NULL ? 'skipped' : ($result ? 'passed' : ($required === REQUIRED ? 'failed' : 'warning')) ?>
	<?php $class2 = $required === REQUIRED ? 'required' : 'optional' ?>
	<tr id="res<?php echo $id ?>">
		<td class="<?php echo $class1 ?>"><?php echo $class1, $script ?></td>
		<th class="<?php echo $class2 ?>"><?php echo htmlSpecialChars($name) ?></th>
		<td class="<?php echo $class2 ?>"><?php echo htmlSpecialChars($hint) ?></td>
	</tr>
	<?php endforeach ?>
	</table>

	<p>Legend: <span class="passed">passed</span> <span class="failed">failed</span> <span class="warning">warning</span> <span class="required">required</span> <span class="optional">optional</span></p>

	<p>Requirements Checker version <?php echo CHECKER_VERSION ?></p>
</body>
</html>